#!/bin/bash

echo "[auto_check]: pic_in=$1"

echo "no_red"
./no_red/no_red $1 100 #120 #is for room #170 is for sample datas
cp no_red_out.jpg processing.jpg

echo "cut"
#modify light problems
./cut/cut processing.jpg
cp cut_out.jpg processing.jpg

echo "smooth"
./smooth/smooth processing.jpg
cp smooth_out.jpg processing.jpg

echo "area_first"
./area_first/area_first processing.jpg
cp area_first_out.jpg processing.jpg

echo "area_second"
./area_second/area_second area_first_out.jpg

echo "area_third"
for i in $(seq 1 8)
do
	./area_third/area_third area_second_$i.jpg $i
done

echo "ODCR ing"
for i in $(seq 1 8)
do
	#resize
	./resize area_third_$i.jpg resized_$i.jpg #./resize in.jpg out.jpg

	#50 feature
	./make_svmdata resized_$i.jpg 10
	cat num_result.txt > ODCR

	#pca
	py pca.py resized_$i.jpg 48 #n_component
	
	#combine (my own 50 feature)+(pca x n_component)
	./combine.py 1 #how many pic

	#svm
	svm-scale -r svm_param svm_test > svm_test_scaled
	svm-predict svm_test_scaled svm_train_scaled.model result_$i.txt

	echo "$i:$(cat result_$i.txt)"
done


echo "Heron, here is your result:"
for i in $(seq 1 8)
do
	cat result_$i.txt
done

echo "save to result_total.txt"
echo "Here: "
./mix_up
cat result_total.txt
